/*
 * Created by JFormDesigner on Thu Aug 31 18:56:05 CST 2023
 */

package src;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * @author Lenovo
 */
public class mainPage extends JFrame {
    public mainPage() {
        initComponents();
    }

    private void comboBox1chance(ActionEvent e) {


        // TODO add your code here
    }

    private void comboBox1ItemStateChanged(ItemEvent e) {
        String str = (String)e.getItem();
        if(str.equals("添加窗口")){
            dispose();
            addPage ap = new addPage();
            ap.setVisible(true);
        }
        if(str.equals("删除窗口")){
            dispose();
           delPage dp = new delPage();
           dp.setVisible(true);
        }
        if(str.equals("修改窗口")){
            dispose();
            changePage cp = new changePage();
            cp.setVisible(true);
        }
        if(str.equals("查询窗口")){
            dispose();
            lookPage lp = new lookPage();
            lp.setVisible(true);
        }
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        panel1 = new JPanel();
        Watermark = new JLabel();
        comboBox1 = new JComboBox();
        comboBox1.addItem("----");
                comboBox1.addItem("添加窗口");
                comboBox1.addItem("删除窗口");
                comboBox1.addItem("修改窗口");
                comboBox1.addItem("查询窗口");

        //======== this ========
        var contentPane = getContentPane();
        contentPane.setLayout(null);

        //======== panel1 ========
        {
            panel1.setLayout(null);

            //---- Watermark ----
            Watermark.setText("@produce by kangwei.");
            Watermark.setForeground(new Color(0xcccccc));
            panel1.add(Watermark);
            Watermark.setBounds(385, 320, 140, 15);

            //---- comboBox1 ----
            comboBox1.addItemListener(e -> comboBox1ItemStateChanged(e));
            panel1.add(comboBox1);
            comboBox1.setBounds(new Rectangle(new Point(5, 5), comboBox1.getPreferredSize()));

            {
                // compute preferred size
                Dimension preferredSize = new Dimension();
                for(int i = 0; i < panel1.getComponentCount(); i++) {
                    Rectangle bounds = panel1.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = panel1.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                panel1.setMinimumSize(preferredSize);
                panel1.setPreferredSize(preferredSize);
            }
        }
        contentPane.add(panel1);
        panel1.setBounds(0, 0, 525, 340);

        {
            // compute preferred size
            Dimension preferredSize = new Dimension();
            for(int i = 0; i < contentPane.getComponentCount(); i++) {
                Rectangle bounds = contentPane.getComponent(i).getBounds();
                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
            }
            Insets insets = contentPane.getInsets();
            preferredSize.width += insets.right;
            preferredSize.height += insets.bottom;
            contentPane.setMinimumSize(preferredSize);
            contentPane.setPreferredSize(preferredSize);
        }
        pack();
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    private JPanel panel1;
    private JLabel Watermark;
    private JComboBox comboBox1;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
